﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace KinectTD.Towers
{
    class Bullet
    {

        private Texture2D texture;

        private Vector2 position;

        public Vector2 Position
        {
            get { return position;  }
        }
        private Vector2 direction;

        public Vector2 Direction 
        {
            get { return direction; }
            
        }
        private float speed;

        public float Speed
        {
            get { return speed; }
           
        }

        private Vector2 size;

        private float colRadius;
        public float CollisionRadius
        {
            get { return colRadius; }
        }

        public Vector2 Origin
        {
            get { return new Vector2(position.X + (size.X / 2), position.Y + (size.Y / 2)); }
        }


        public Bullet(Vector2 dir, float speed, Vector2 position, Texture2D bullTexture)
        {
            dir.Normalize();

            this.direction = dir;
            this.speed = speed;
            this.position = position;
            texture = bullTexture;
            size = new Vector2(20);
            colRadius = 10;
        }

        public void Update(GameTime gametime)
        {
            position += direction * new Vector2(speed);
        }
        
        public void Draw(SpriteBatch spriteBatch)
        {
            spriteBatch.Draw(texture, new Rectangle((int)position.X, (int)position.Y, 20, 20), Color.White);
        }
        
    }
}
